package com.xhl.doeverything.controller;

import com.xhl.doeverything.dozer.DozerUtils;
import com.xhl.doeverything.dto.UserTest;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

/**
 * @author xionghuilong
 * @description: TODO
 * @date 2021/11/29 16:58
 */
@Component
public class TestMain {
    private static int count=1;
    @Resource
    private DozerUtils dozer;
    public static void main(String[] args) {
        recurseDemo();
//        recurseDemo2(1,2);
    }
    private static void recurseDemo(){
        System.out.println(++count);
        recurseDemo();
    }
    private static void recurseDemo2(int a,int b){
        int c=0,d=0,f=0,j=0,k=0,i=0;
        System.out.println(++count);
        recurseDemo2(a,b);
    }

    private static void java8SortDemo(){
        List<UserTest> list = new ArrayList<>();
        list.add(UserTest.builder().age(10).height(175).weight(100).build());
        list.add(UserTest.builder().age(10).height(155).weight(140).build());
        list.add(UserTest.builder().age(10).height(155).weight(170).build());
        list.add(UserTest.builder().age(40).height(195).weight(80).build());
        list.forEach(e->{
            System.out.println(e.getAge() + " | " + e.getHeight() + " | " + e.getWeight());
        });
        System.out.println("===================================================");
        list.sort(Comparator.comparing(UserTest::getAge).reversed()
                .thenComparing(UserTest::getHeight).reversed()
                .thenComparing(UserTest::getWeight).reversed());
//        list = list.stream().sorted(Comparator.comparing(UserTest::getAge)
//                .thenComparing(UserTest::getHeight).reversed()
//                .thenComparing(UserTest::getWeight).reversed()).collect(Collectors.toList());
        list.forEach(e->{
            System.out.println(e.getAge() + " | " + e.getHeight() + " | " + e.getWeight());
        });
    }
}
